package com.example.spingcloudconsumer.controller;

import com.example.spingcloudconsumer.client.UserClient;
import com.example.spingcloudconsumer.pojo.User;
import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@Controller
@RequestMapping("consumer/user")
public class UserController {

   /* @Autowired
    private RestTemplate restTemplate;*/

    /*@Autowired
    private DiscoveryClient discoveryClient;*/
    @Autowired
    private UserClient uClient;
    @GetMapping
    @ResponseBody
    public String queryUserById(@RequestParam("id") Long id){

        String user = uClient.queryById(id);
        return user;
     }



}